#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    int n,m,a,b;
    cin >> n >> m;
    int cnt=n*(n-1);
    cout << cnt - m;
    return 0;
}